package com.shiroexploit.util;

public class RememberMeCache {
    private static RememberMeCache rememberMeCache;

//    case "SpringEcho1":
//            case "SpringEcho2":
//            case "Tomcat6Echo":
//            case "Tomcat7_8Echo":
//            case "Tomcat9Echo":
//            case "WeblogicEcho1":
//            case "ResinEcho":
//            case "JettyEcho":
//            case "AutoFindRequestEcho":

    private String SpringEcho1Cache;
    private String SpringEcho2Cache;
    private String Tomcat6EchoCache;
    private String Tomcat7_8EchoCache;
    private String Tomcat9EchoCache;
    private String WeblogicEcho1Cache;
    private String ResinEchoCache;
    private String JettyEchoCache;
    private String AutoFindRequestEchoCache;

    private RememberMeCache(){

    }

    public static RememberMeCache getInstance(){
        if(rememberMeCache == null){
            rememberMeCache = new RememberMeCache();
        }

        return rememberMeCache;
    }

    public String getSpringEcho1Cache() {
        return SpringEcho1Cache;
    }

    public void setSpringEcho1Cache(String springEcho1Cache) {
        SpringEcho1Cache = springEcho1Cache;
    }

    public String getSpringEcho2Cache() {
        return SpringEcho2Cache;
    }

    public void setSpringEcho2Cache(String springEcho2Cache) {
        SpringEcho2Cache = springEcho2Cache;
    }

    public String getTomcat6EchoCache() {
        return Tomcat6EchoCache;
    }

    public void setTomcat6EchoCache(String tomcat6EchoCache) {
        Tomcat6EchoCache = tomcat6EchoCache;
    }

    public String getTomcat7_8EchoCache() {
        return Tomcat7_8EchoCache;
    }

    public void setTomcat7_8EchoCache(String tomcat7_8EchoCache) {
        Tomcat7_8EchoCache = tomcat7_8EchoCache;
    }

    public String getTomcat9EchoCache() {
        return Tomcat9EchoCache;
    }

    public void setTomcat9EchoCache(String tomcat9EchoCache) {
        Tomcat9EchoCache = tomcat9EchoCache;
    }

    public String getWeblogicEcho1Cache() {
        return WeblogicEcho1Cache;
    }

    public void setWeblogicEcho1Cache(String weblogicEcho1Cache) {
        WeblogicEcho1Cache = weblogicEcho1Cache;
    }

    public String getResinEchoCache() {
        return ResinEchoCache;
    }

    public void setResinEchoCache(String resinEchoCache) {
        ResinEchoCache = resinEchoCache;
    }

    public String getJettyEchoCache() {
        return JettyEchoCache;
    }

    public void setJettyEchoCache(String jettyEchoCache) {
        JettyEchoCache = jettyEchoCache;
    }

    public String getAutoFindRequestEchoCache() {
        return AutoFindRequestEchoCache;
    }

    public void setAutoFindRequestEchoCache(String autoFindRequestEchoCache) {
        AutoFindRequestEchoCache = autoFindRequestEchoCache;
    }


    public void setRememberMe(EchoType echoType, String rememberMeCookie){
        if(echoType.getName().equals("SpringEcho1")){
            setSpringEcho1Cache(rememberMeCookie);
        }else if(echoType.getName().equals("SpringEcho2")){
            setSpringEcho2Cache(rememberMeCookie);
        }else if(echoType.getName().equals("Tomcat6Echo")){
            setTomcat6EchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("Tomcat7_8Echo")){
            setTomcat7_8EchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("Tomcat9Echo")){
            setTomcat9EchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("WeblogicEcho1")){
            setWeblogicEcho1Cache(rememberMeCookie);
        }else if(echoType.getName().equals("ResinEcho")){
            setResinEchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("JettyEcho")){
            setJettyEchoCache(rememberMeCookie);
        }else if(echoType.getName().equals("AutoFindRequestEcho")){
            setAutoFindRequestEchoCache(rememberMeCookie);
        }
    }

    public String getRememberMe(EchoType echoType){
        if(echoType.getName().equals("SpringEcho1")){
            return getSpringEcho1Cache();
        }else if(echoType.getName().equals("SpringEcho2")){
            return getSpringEcho2Cache();
        }else if(echoType.getName().equals("Tomcat6Echo")){
            return getTomcat6EchoCache();
        }else if(echoType.getName().equals("Tomcat7_8Echo")){
            return getTomcat7_8EchoCache();
        }else if(echoType.getName().equals("Tomcat9Echo")){
            return getTomcat9EchoCache();
        }else if(echoType.getName().equals("WeblogicEcho1")){
            return getWeblogicEcho1Cache();
        }else if(echoType.getName().equals("ResinEcho")){
            return getResinEchoCache();
        }else if(echoType.getName().equals("JettyEcho")){
            return getJettyEchoCache();
        }else if(echoType.getName().equals("AutoFindRequestEcho")){
            return getAutoFindRequestEchoCache();
        }

        return null;
    }


}
